home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / nurbsTrim / README < prev   
Text File  |  1996-11-11  |  5KB  |  99 lines

  1.  
  2.             ~4Dgifts/toolbox/src/exampleCode/opengl/nurbsTrim README
  3.      
  4.              nurbsTrim - A NURBS surface trimmed by a NURBS curve
  5.      
  6.      
  7.       
  8.       "Trimming NURBS surfaces is considered an advanced topic.  If this
  9.       is your first exposure to a NURBS, experiment first with curves
  10.       and surfaces, then move on to trimmed surfaces."
  11.       
  12.                       Josie Wernecke, _The Inventor Mentor_
  13.       
  14.       
  15.       No foolin', Josie!  There are some fine points of trimming NURBS
  16.       that are probably documented somewhere, but I came upon them the
  17.       hard way.
  18.       
  19.       This directory contains examples of trimmed NURBS in OpenGL and
  20.       in Inventor, as well as an easy Makefile and this README. 
  21.       
  22.       To make sense of the examples, make sure you know the NURBS basics,
  23.       then read about the obstacles I encountered along the way to making
  24.       trimmed NURBS work.
  25.       
  26.       Good background reading can be found in chapter 11, "Evaluators
  27.       and NURBS", of the OpenGL Programming Guide, especially in the
  28.       section on "The GLU NURBS Interface" (pages 343-353), and in
  29.       chapter 8, "Curves and Surfaces", of the Inventor Mentor, especially
  30.       in the section on "NURBS Surfaces" (pages 199-207).  The complete
  31.       bibliographic references are
  32.       
  33.               J. Neider, T. Davis, M. Woo, _OpenGL Programming Guide_,
  34.               (1993, Addison Wesley) ISBN #0-201-63274-8.
  35.       
  36.               J. Wernecke, _The Inventor Mentor_, (1993, Addison Wesley)
  37.               ISBN #0-201-62495-8.
  38.       
  39.       Knot values for NURBS curves and surfaces are not important; the
  40.       only thing that matters is the values of the knots relative to one
  41.       another.  Knot vectors must be monotonically non-decreasing, and 
  42.       when the same knot value is repeated k times, the curve or surface
  43.       displays an (N-k)th order discontinuity, where N is the order of
  44.       the NURBS.  This is widely known and well documented.
  45.       
  46.       But not so widely known is that knot values for trimmed NURBS 
  47.       surfaces do indeed matter.  The control points of the profile
  48.       curve must all reside in a rectangle in U-V space defined by the
  49.       knot vectors of the NURBS surface.  Control points outside of
  50.       this rectangle cause the surface not to be rendered.
  51.       
  52.       In the Inventor example, the knot vectors of the NURBS surface are
  53.       
  54.               uKnotVector [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
  55.               vKnotVector [ 2, 2, 2, 2, 3, 4, 4, 4, 4 ]
  56.       
  57.       There are 10 U knots, and the surface has 6 U control points, so it
  58.       is of order 4 (=10-6) in the U dimension.  Likewise, because there
  59.       are 9 V knots and 5 V control points, it is of order 4 (=9-5) in the
  60.       V dimension.
  61.       
  62.       Because the order is 4, notice the 4th and (numKnots-4)th knots.
  63.       These knots define the boundaries of the valid region in U-V space
  64.       where the surface is actually visible.  Counting 4 knots in, from
  65.       the ends of the U knot vector, we see knots with values of 3 and 6. 
  66.       Likewise, counting 4 knots in from both ends of the V knot vector,
  67.       we see knots with values of 2 and 4.
  68.       
  69.       The values for the control points of the NURBS profile curve must fall
  70.       into the rectangle in U-V space defined by [(3,2),(6,4)].  The points
  71.       of the profile curve are, in fact,
  72.       
  73.               point   [  3.3 2.5, 5.7 2.5, 5.7 3.5, 3.3 3.5 ]
  74.       
  75.       Another tricky area with NURBS profile curves is clearly documented
  76.       but easy to forget:  curve orientation.  The first profile on a
  77.       trimmed surface must be CCW in U-V parameter space.  A CCW profile
  78.       trims the region outside the closed loop formed by the curve (or curves).
  79.       A CW profile trims the region inside the closed loop.  The rule of
  80.       thumb is that the trimmed region always lies to the right of the
  81.       trimming curve as you traverse from beginning to end.
  82.       
  83.       If you can't get your trimmed NURBS surfaces to display in inventor,
  84.       install inventor_dev.sw.debug, and use the Inventor Debug libraries.
  85.       setenv LD_LIBRARY_PATH /usr/lib/InventorDebug, then when you run
  86.       ivview from the shell prompt, the debug library will sometimes reveal
  87.       your error.
  88.       
  89.       I have tested the examples on an Indigo 2 Extreme, running Irix 5.2
  90.       and Inventor 2.0.  Results may vary on other platforms.
  91.       
  92.       Thanks to Dave Immel and Derrick Burns for the geometry lessons, and
  93.       to Paul David for trampling the path a few steps ahead of me.
  94.       
  95.       
  96.                                       Aaron Schuman
  97.       
  98.       
  99.